import { reqAddressInfo, reqOrderInfo } from '@/api/index.js'
const state = {
  address: [],
  orderInfo: {}
}
const mutations = {
  GETADDRESSINFO (state, address) {
    state.address = address
  },
  GETORDERINFO (state, orderInfo) {
    state.orderInfo = orderInfo
  }
}
const actions = {
  // 获取用户地址信息
  async getAddressInfo ({commit}) {
    const {data: res} = await reqAddressInfo ()
    if (res.code == 200) {
      commit ('GETADDRESSINFO', res.data)
    }
  },

  // 获取商品清单
  async getOrderInfo ({commit}) {
    const {data: res} = await reqOrderInfo ()
    if (res.code == 200) {
      commit ('GETORDERINFO', res.data)
    }
  }
}
const getters = {}

export default {
  state,
  mutations,
  actions,
  getters
}
